$(function() {
	$('#inviteUserLog').click(function() {
		$('#inviteUserLog').attr('class', 'btnorangebig_hover');
		queryInviteUserDetail(1);
	});

	$('#inviteUserLog').click();
});

var inviteUserDetailPage = new Page("inviteUserDetailPage", queryInviteUserDetail, "bodyInfo", "bodyInfoPage");
inviteUserDetailPage.size = 5;
inviteUserDetailPage.pageSizeArr = [5, 10, 15];
//设置开始字符串
inviteUserDetailPage.beginString = '<table><thead><tr>'
							+'<th>昵称</th>'
							+'<th>粉丝数</th>'
							+'<th>关注数</th>'
							+'<th>邀请时间</th></tr></thead><tbody>';
//设置结束字符串
inviteUserDetailPage.endString = "</tbody></table>";
/**
 * 查看当前用户邀请的详细信息
 */
function queryInviteUserDetail(_page) {
	if(_page != undefined) {
		inviteUserDetailPage.page = _page;
	}
	jQuery.ajax({
		url : webroot + "/userCenter/json/findInviteFriendInfo.shtml",
		data : {
			"username" : $('#userInfoUsername').val(),
			"page" : inviteUserDetailPage.page,
			"size" : inviteUserDetailPage.size
		},
		type : "POST",
		dataType : "json",
		async : true,
		beforeSend: function(){
			//提交处理的函数
			inviteUserDetailPage.pageBeforeSend('<tr><td colspan="4">加载邀请信息中...</td></tr>');
			loading("加载邀请信息中...");
		},
		error : function(json){
			inviteUserDetailPage.pageError('<tr><td colspan="4">加载邀请信息出错了~</td></tr>');
			unloading();
		},
		//返回的是一个对象
		success : function(json){
			if(json.result === "success") {
				//处理数据列表的行信息
				function getResult(obj) {
					var result = '<tr><td><a class="a_blue" href="http://weibo.com/u/' + obj.username + '" target="_banlk">' + obj.nickname + '</a></td><td>'
								+ obj.fansnum + '</td><td>' + obj.attentionnum + '</td><td>' + dateUtil.getFormatDate(new Date(obj.createtime)) + '</td></tr>';
					return result;
				}
				inviteUserDetailPage.pageOperate(json.data, { resultFn : getResult, dataNull : '<tr><td colspan="4">没有查找到邀请用户的数据!</td></tr>', pageFootStyle : inviteUserDetailPage.pageStyle.defaultStyle });
			}
			else if(json.result === "error") {
				alert("请求操作, 系统出现异常!");
			}
			unloading();
		}
	});
}